//
//  ZZBaseVC.m
//  新项目
//
//  Created by 刘耀宗 on 2016/12/19.
//  Copyright © 2016年 刘耀宗. All rights reserved.
//

#import "ZZBaseVC.h"
#import "DMNoDataView.h"

@interface ZZBaseVC () <DMNoDataDelegate>
@property (strong, nonatomic) DMNoDataView *noDataView;
@end

@implementation ZZBaseVC
@synthesize noDataView = _noDataView;

- (void)dealloc {
    [_noDataView.view removeFromSuperview];
    _noDataView = nil;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    UIView *statusBarView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, newwidth, 20)];
    
    statusBarView.backgroundColor=[UIColor whiteColor]
    ;
    
    [self.view addSubview:statusBarView];
    
//    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
    // 去除导航栏下方的横线
//    BOOL result = [UINavigationBar appearance].isTranslucent;
//    if(result){
//        self.navigationController.navigationBar.subviews[0].subviews[1].hidden = YES;
//    }else{
//        self.navigationController.navigationBar.subviews[0].subviews[0].hidden = YES;
//    }
}

/**
 创建 无数据、无网络视图
 1:暂无数据
 2:网络不好
 */
- (void)creatNoDataViewAction:(NSInteger)theMark {
    if(!_noDataView){
        _noDataView = [[DMNoDataView alloc] initWithNibName:@"DMNoDataView" bundle:nil];
    }
    [_noDataView.view setFrame:[UIScreen mainScreen].bounds];
    _noDataView.delegate = self;
    [self.view addSubview:_noDataView.view];
    [_noDataView displayViewMark:theMark];
}

// 移除 无数据、无网络视图
- (void)removeNoDataViewAction {
    [_noDataView.view removeFromSuperview];
    _noDataView = nil;
}

#pragma mark DMNoDataDelegate
- (void)noDataTapAction:(NSInteger )theMark {
    if(theMark == 1){
        // 点击按钮 去添加
        
    }else if(theMark == 2){
        // 点击按钮 再试试
    }
}

@end
